package com.ymu.beyond.sshDay3;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

public class TimeInterceptor extends AbstractInterceptor {

	private static final long serialVersionUID = 1L;

	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		long StartTime = System.currentTimeMillis();
		// 拦截器放行，让其它拦截器执行，如果没有其它拦截器了就会直接到Action
		String result = invocation.invoke();
		long endTime = System.currentTimeMillis();
		System.out.println("Action executed time" + (endTime - StartTime)
				+ "result:" + result);

		return null;
	}

}
